//
//  LTCRechargeView.m
//  BTCoin
//
//  Created by Robin on 26/03/2018.
//  Copyright © 2018 Robin. All rights reserved.
//

#import "LTCRechargeView.h"

@implementation LTCRechargeView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
        UIView * CIQRCodeView = [[UIView alloc] init];
        CIQRCodeView.backgroundColor = [UIColor whiteColor];
        [self addSubview:CIQRCodeView];
        [CIQRCodeView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.leading.trailing.equalTo(self);
            make.height.mas_equalTo(300.0);
        }];
        
        self.codeImageView = [[UIImageView alloc] init];
        [self addSubview:self.codeImageView];
        [self.codeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).offset(30.0);
            make.centerX.equalTo(self);
            make.width.height.mas_equalTo(200.0);
        }];
        
        UILabel * copyTitle = [[UILabel alloc] init];
        [copyTitle setFont:[UIFont systemFontOfSize:17]];
        [copyTitle setTextColor:color_333333];
        copyTitle.text = @"点击二维码复制地址";
        [copyTitle setTextAlignment:NSTextAlignmentCenter];
        [CIQRCodeView addSubview:copyTitle];
        [copyTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(CIQRCodeView).offset(-10);
            make.centerX.equalTo(CIQRCodeView);
        }];
        
        UIView * addressView = [[UIView alloc] init];
        addressView.backgroundColor = [UIColor whiteColor];
        [self addSubview:addressView];
        [addressView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).offset(20);
            make.trailing.equalTo(self).offset(-20);
            make.top.equalTo(CIQRCodeView.mas_bottom).offset(20);
            make.bottom.equalTo(self);
        }];
        
        UILabel * addressTitle = [[UILabel alloc] init];
        [addressTitle setFont:[UIFont systemFontOfSize:15]];
        [addressTitle setTextColor:color_d2d2d2];
        addressTitle.text = @"地址";
        [addressTitle setTextAlignment:NSTextAlignmentCenter];
        [addressView addSubview:addressTitle];
        [addressTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(addressView);
            make.leading.equalTo(addressView).offset(10);
        }];
        
        self.addressLabel = [[UILabel alloc] init];
        self.addressLabel.numberOfLines = 0;
        [self.addressLabel setFont:[UIFont systemFontOfSize:15]];
        [self.addressLabel setTextColor:color_333333];
        [self.addressLabel setTextAlignment:NSTextAlignmentCenter];
        [addressView addSubview:self.addressLabel];
        [self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(addressView);
            make.leading.equalTo(addressTitle.mas_trailing).offset(10);
            make.trailing.equalTo(addressView).offset(-10);
        }];
    }
    
    return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
